#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <QTimer>
#include <QPaintEvent>
#include <QPixmap>
#include <QPainter>
#include <QMouseEvent>
#include <QList>
#include <QPair>
#include <QMessageBox>

#include "button.h"
#include "watch.h"

struct File_not_found_error {};     // 未找到文件

QT_BEGIN_NAMESPACE
namespace Ui {
class MainWindow;
}
QT_END_NAMESPACE

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    MainWindow(QWidget *parent = nullptr);
    ~MainWindow();

private slots:
    void frame_update();
    
protected:
    void paintEvent(QPaintEvent* event);

    void mousePressEvent(QMouseEvent* event);
    
private:
    Ui::MainWindow *ui;
    QTimer timer;
    QPixmap snapshot;
    Watch::Watch* watch;
    Tm::Time time;
    void update_snapshot();     // 绘制每一帧
    Butt::Button* button;
    QList<QPair<Tm::Time,Voice_type>> sounds;
    QString quit;
};

#endif // MAINWINDOW_H
